<link rel="stylesheet" href="__STATIC__mobile/css/orderdetail.css">
<link rel="stylesheet" href="__STATIC__mobile/css/orderlist.css">
<style>
body {
	background: #f3f3f3;
}
.J_del {
	background: #d9534f !important;
}

.msettlement_tpay_span {
	width: 25px;
	display: inline-block;
	height: 22px;
	position: relative;
}

.msettlement_tpay_span em {
	display: block;
	width: 20px;
	height: 20px;
	position: absolute;
	top: 0px;
	left: -3px;
	overflow: hidden;
	border: #dedede solid 1px;
	background: #FDFDFD;
	border-radius: 50%;
}

.msettlement_tpay_span em.cur {
	background: url(/Static/mobile/images/set3.png) no-repeat;
	background-size: 20px;
	border: 0;
}

.mintegral_contentlist .con p {
  line-height: 22px;
  color: #676767;
  margin-bottom: 10px;
}
</style>
<?php if($order['checked'] == 0){ ?>
	<script type="text/javascript">

		//调用微信JS api 支付
		function jsApiCall()
		{
			WeixinJSBridge.invoke(
				'getBrandWCPayRequest',
				<?php echo $jsApiParameters;?>,
				function(res){
					WeixinJSBridge.log(res.err_msg);
					 if(res.err_msg == "get_brand_wcpay_request:ok" ) {
					 
					   location.href = "/mobile/order/lists";
					 
					 }else if(res.err_msg == "get_brand_wcpay_request:cancel"){
					 
						//alert("未支付成功,请重试");
					 }
					//alert(res.err_msg);

				}
			);
		}

		function callpay()
		{
			if (typeof WeixinJSBridge == "undefined"){
			    if( document.addEventListener ){
			        document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
			    }else if (document.attachEvent){
			        document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
			        document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
			    }
			}else{
			    jsApiCall();
			}
		}
	</script>
<?php } ?>

<div class="membersbox pad50">
	<div class="orderDetailtit clearfix">
		<div class="info-item fl">
			<p>
				<span>订单：</span> <span><?php echo $order['order_sn'];?></span>
			</p>
			<p>
				<span>时间：</span> <span><?php echo $order['create_time'];?></span>
			</p>

		</div>
		<div class="info-item fr">
			<span class="org"><?php echo $order['status'];?></span>
		</div>
	</div>
	<div class="orderDetail">
		<ul class="goods">
		
			<?php foreach($order['goods'] as $k=>$v){?>
			<li><a href="/mobile/goods/index/?goods_id=<?php echo $v['goods_id'];?>" class="clearfix">
					<div class="goods-img fl">
						<img style="min-height:78px;" src="<?php echo C("UPYUN_DOMAIN").$v['goods_pic'];?>!headimgurl"  onerror="javascript:this.src='__STATIC__mobile/images/goods.jpg';">
					</div>
					<div class="goods-info">
						<p class="title"><?php echo $v['goods_name'];?> <?php echo $v['guige_name'] ? '【'.$v['guige_name'].'】' : '';?></p>
						<p class="sku">
							<span>数量：×<?php echo $v['num'];?></span> <span></span> 
							<span class="price" style="float:right;">小计：¥<?php echo round($v['shop_price']*$v['num'],2);?></span>
						</p>
						<p style="margin-top:10px;"><span>单价：¥<?php echo $v['shop_price'];?></span></p>
					</div>
			</a>
			</li>
			
			
			<?php } ?>
			
		</ul>
		<ul class="money">

			 <li class="clearfix">
                <span class="fl">商品总价:</span>
                <span class="fr colorRed">&yen;<?php echo $order['pay_orgmoney'];?></span>
            </li>
            
            <?php if($order['coupon_money']>0){?>
			 <li class="clearfix">
                <span class="fl">红包优惠:</span>
                <span class="fr colorRed">-&yen;<?php echo $order['coupon_money'];?></span>
            </li>
            <?php }?>
            
            <?php if($order['tihuo_money']>0){?>
			 <li class="clearfix">
                <span class="fl"><?php echo C('TIHUO_NAME');?>支付:</span>
                <span class="fr colorRed">-&yen;<?php echo $order['tihuo_money'];?></span>
            </li>
            <?php }?>
            
            <?php if($order['score_money']>0){?>
			 <li class="clearfix">
                <span class="fl"><?php echo C('SCORE_NAME');?>支付:</span>
                <span class="fr colorRed">-&yen;<?php echo $order['score_money'];?></span>
            </li>
            <?php }?>
            
            <?php if($order['yongjin_money']>0){?>
			 <li class="clearfix">
                <span class="fl"><?php echo C('YONGJIN_NAME');?>支付:</span>
                <span class="fr colorRed">-&yen;<?php echo $order['yongjin_money'];?></span>
            </li>
            <?php }?>
            
            <?php if($order['cash_money']>0){?>
			 <li class="clearfix">
                <span class="fl"><?php echo C('CASH_NAME');?>支付:</span>
                <span class="fr colorRed">-&yen;<?php echo $order['cash_money'];?></span>
            </li>
            <?php }?>
            
            <?php if($order['pay_money']>0){?>
			 <li class="clearfix">
                <span class="fl">微信支付:</span>
                <span class="fr colorRed">&yen;<?php echo $order['pay_money'];?></span>
            </li>
            <?php }?>

			<li class="clearfix"><span class="fl">运费：</span> <span
				class="fr colorRed">¥<?php echo $order['shipping'];?></span></li>
		</ul>
		
		<?php if($order['zhekou_money'] > 0){ ?>
		<ul class="money">
			<li class="clearfix "><span class="fl">会员折扣优惠：</span> 
			<span class="fr colorRed">-¥<?php echo round($order['zhekou_money'],2);?></span></li>
		</ul>
		<?php } ?>
		
		<ul class="money">
			<li class="clearfix "><span class="fl">总计金额(含运费)：</span> <span
				class="fr colorRed">¥<?php echo round($order['pay_orgmoney']+$order['shipping']-$order['zhekou_money'],2);?></span></li>
		</ul>
		
		<?php if($order['checked'] == 0){ ?>
		<section class="actions">
			<a href="javascript:jsApiCall();" class="mbtn btn-success btn-big " >使用微信安全支付¥<?php echo $order['pay_money'];?></a>
			<!-- 蓝色按钮J_pay -->
		</section>
		<?php } ?>
		

		<ul class="money address">
			<li>收货信息：</li>
			<li class="clearfix">
				<span class="fl"><?php echo $order['delivery_name'];?></span>
			 	<span class="fr"><?php echo $order['delivery_mobile'];?></span>
			 </li>
			<li><?php echo $order['delivery']['province'];?> <?php echo $order['delivery']['city'];?> <?php echo $order['delivery']['county'];?> <?php echo $order['delivery']['address'];?></li>
			
			<?php if($order['delivery']['wechat_user']){?>
			<li class="clearfix">
				<span class="fl">微信号:</span>
			 	<span class="fr"><?php echo $order['delivery']['wechat_user'];?></span>
			 </li>
			<?php } ?>
		</ul>
		
		<?php if($order['express']){?>
		<ul class="money address">

			<li class="clearfix">
				<span class="fl">物流状态：</span>
			 	<span class="fr"><?php echo $wuliu_status;?></span>
			 </li>
			
			<li class="clearfix">
				<span class="fl"><?php echo $order['express'];?></span>
			 	<span class="fr"><?php echo $order['express_no'];?></span>
			 </li>
		</ul>
		
			 
		<?php if($wuliu_res){?>
        <section class="mintegral_contentlist" style="font-size:14px;margin-left:5px;">
        
			<section class="tit"><span>物流跟踪：</span>
                <em>点击查看详情</em>
                 <b></b></section>
			<section class="con">
			
			 <?php foreach($wuliu_res as $k=>$v){?>
					<p><?php echo $v['time'];?>--<?php echo trim($v['content']);?></p>
			 <?php } ?>

			</section>
			
			
		</section>
		<?php } ?>	
		<?php } ?>
		
		<!-- 0待支付,1已付款,,2完成,3.待退款 4已退款,5发货,0未完成,6订单关闭, -->
		<section class="actions">
			<?php if($order['checked'] == 5){ ?>
			<a href="javascript:shouhuo('<?php echo $order['order_id'];?>');" class="mbtn btn-success btn-big J_pay" >确认收货</a>
			<?php }else if($order['checked'] == 1){ ?>
			
			<!-- 
			<a href="javascript:tuikuan('<?php echo $order['order_id'];?>');" class="mbtn btn-success btn-big J_del"  style="color:#666;">退 款</a>
			 -->
			 
			 
			<?php }else if($order['checked'] == 3){ ?>
			<a href="javascript:quxiaotuikuan('<?php echo $order['order_id'];?>');" class="mbtn btn-success btn-big J_pay" >取消退款</a>
			<?php } ?>
			<!-- 蓝色按钮J_pay -->
			
			<?php if($order['checked'] == 0){ ?>
			<a href="javascript:cancel('<?php echo $order['order_id'];?>');" class="mbtn btn-success btn-big J_del"  style="color:#666;">取消订单</a>
			<?php } ?>
			
		</section>
	</div>


</div>

<script>
$(function(){
	//展开与收缩
	$(".mintegral_contentlist .tit").click(function(){
		$(this).siblings().toggle();
		if($(this).siblings().css("display")=="none"){
			$(this).find('b').removeClass('cur');
			$(this).parents('.mintegral_contentlist').css("border-bottom","0px");
		}else{
			$(this).find('b').addClass('cur');
			$(this).parents('.mintegral_contentlist').css("border-bottom","#dddddd solid 1px");
		}
	});
});
/*
 * 确认收货
 */
function shouhuo(id){
    layer.open({
        content: "你已经收到货物了吗?",
        btn: ['已收到', '取消'],
        yes: function(index){
        //	showerror("抱歉,退款功能正在开发中,谢谢关注");
        //	return false;
        	AjaxUrl('/mobile/order/shouhuo/?order_id='+id);
            layer.close(index);
        }
    });
}


/*
 * 取消订单
 */
function cancel(id){
    layer.open({
        content: "你确定要取消订单吗?",
        btn: ['我确定', '我再想想'],
        yes: function(index){
        //	showerror("抱歉,退款功能正在开发中,谢谢关注");
        //	return false;
        	AjaxUrl('/mobile/order/cancel/?order_id='+id);
            layer.close(index);
        }
    });
}


/*
 * 退款
 */
function tuikuan(id){
    layer.open({
        content: "亲,你确定要退款吗?",
        btn: ['确定', '取消'],
        yes: function(index){
        	AjaxUrl('/mobile/order/tuikuan/?order_id='+id);
            layer.close(index);
        }
    });
}


/*
 * quxiaotuikuan
 */
 function quxiaotuikuan(id){
	    layer.open({
	        content: "亲,你确定要取消退款吗?",
	        btn: ['确定', '取消'],
	        yes: function(index){
	        	AjaxUrl('/mobile/order/quxiaotuikuan/?order_id='+id);
	            layer.close(index);
	        }
	    });
	}
</script>

<include file="Common:nav" />
